﻿using System;
using UnityEngine;

namespace Gp.Scripts.Core {
    public class UnitAnimatorEventTrigger : MonoBehaviour {
        public event Action<string> OnEventTrigger;

        public void Animation_HitTrigger() {
            TriggerAnimationEvent(UnitAnimEventType.AttackHitEvent.EventName());
        }

        public void Animation_MoveTrigger() {
            TriggerAnimationEvent(UnitAnimEventType.AttackMoveStartEvent.EventName());
        }
        
        public void Animation_MoveBackTrigger() {}


        public void Animation_WeaponTakeOutTrigger() {
            TriggerAnimationEvent(UnitAnimEventType.WeaponTakeOut.EventName());
        }

        public void Animation_WeaponTrailEffectTrigger() {
            TriggerAnimationEvent(UnitAnimEventType.TrailEffectActivate.EventName());
        }
        
        public void TriggerAnimationEvent(string eventName) {
            OnEventTrigger?.Invoke(eventName);
        }
    }
}